classdef GR_Axis_2Y
    properties
        FontSize
        Exponent
        TickFmt
        Grid
        Box
        BoxColor
    end
    methods
        function obj=GR_Axis_2Y(Input)
            arguments
                Input.FontSize struct   =   struct('X',10,'Y',[10,10]);
                Input.Exponent struct   =   struct('X',0,'Y',[0,0]);
                Input.TickFmt struct    =   struct('X','%g','Y',{'%g','%g'});
                Input.Grid struct       =   struct('X','on','Y','on');
                Input.Box char          =   'on';
                Input.BoxColor struct   =   struct('X','k','Y','k');
            end
            obj.FontSize    =   Input.FontSize;
            obj.Exponent    =   Input.Exponent;
            obj.TickFmt     =   Input.TickFmt;
            obj.Grid        =   Input.Grid;
            obj.Box         =   Input.Box;
            obj.BoxColor    =   Input.BoxColor;
        end
        function Setup(obj,ax)
            XY  =   {'X','Y'};
            for ii=1:length(XY)
                Axis    =   [XY{ii},'Axis'];
                if strcmp(XY{ii},'Y')
                    for jj=1:2
                        ax.(Axis)(jj).Label.FontSize    =   obj.FontSize.(XY{ii})(jj);
                        ax.(Axis)(jj).Exponent          =   obj.Exponent.(XY{ii})(jj);
                        ax.(Axis)(jj).TickLabelFormat   =   obj.TickFmt.(XY{ii}){jj};
                        ax.(Axis)(jj).Label.Interpreter =   'latex';
                    end
                else
                    
                ax.(Axis).Label.FontSize    =   obj.FontSize.(XY{ii});
                ax.(Axis).Exponent          =   obj.Exponent.(XY{ii});
                ax.(Axis).TickLabelFormat   =   obj.TickFmt.(XY{ii});
                ax.(Axis).Label.Interpreter =   'latex';
                end
                
                ax.([XY{ii},'Grid'])        =   obj.Grid.(XY{ii});
                ax.([XY{ii},'Color'])       =   obj.BoxColor.(XY{ii});
            end
            box(ax,obj.Box);
        end
    end
end